<template>
  <div>
    <!--工具条-->
    <el-col
      :span="24"
      class="toolbar"
      style="padding-bottom: 0px;display: flex; justify-content: space-between"
    >
      <el-form :inline="true">
  
        <el-form-item>
          <el-button type="primary" @click="userStatusRefresh">{{$t('publicbtn.refresh')}}</el-button>
        </el-form-item>
      </el-form>

      <excelexport></excelexport>
    </el-col>

    <!--列表-->

    <el-table
      v-loading="loading"
      :data="userPositionData"
      style="width: 100%"
      id="out-table"
    >
      <el-table-column prop="name" :label="$t('realtimesummary.name')"> </el-table-column>
      <el-table-column prop="value" :label="$t('realtimesummary.value')"> 
         <template slot-scope="props">
         {{ (props.row.value / million).toFixed(8) }}
      </template>
      </el-table-column>
      
    </el-table>
  </div>
</template>

<script>
import excelexport from "@/components/export.vue";
import { getUserRequest, postUserRequest, getNudataRequest } from "@/api/api";
export default {
  name: "userposition",
  components: {
    excelexport,
  },



  data() {
    return {
      million: 100000000,
      loading: true,
      userPositionData: [],
      ustrpostitionParameter: {
        type: 1,
      },
    };
  },
  computed:{
 
  },
  methods: {
    usertionSelect() {
      this.getUstrpostitionData();
    },
    userStatusRefresh(){
     this.getUstrpostitionData()
    },

    getUstrpostitionData() {
     this.loading= true

      getUserRequest(this.ustrpostitionParameter, "/getPositionTotal").then(
        (res) => {
          var data = res.data;
          this.loading = false;
          if (data.code == 200) {
            let position = data.data
            let array = Object.keys(data.data)
            array.map((item)=>{
                let obj = {}
                obj['name'] =item
                obj['value'] = position[item]
                this.userPositionData.push(obj)
            })

          } else {
            this.$message({
              message: data.message,
              type: "error",
            });
          }
     this.loading= false

        });
    },
  },
  mounted() {
    this.getUstrpostitionData();
  },
};
</script>

<style>
</style>